import 'dart:convert';

import 'package:cbec_app/entity/home/content/content_data.dart';

/// page_margin_bottom : 0
/// page_margin_top : 0
/// automatic : "0"
/// prize_color : "#FFF4D1"
/// btn_color : "#FC6561"
/// type : "raffle"
/// animation_color : "rgb(252,255,9)"
/// bg_image : {"attachment_url":""}
/// uuid : "6bde88fb-7b3e-4c79-b9df-1de543657545"
/// btn_text_color : "#FFE6B6"
/// image_fill_style2 : "1"
/// bdr : 8
/// bg_color : "rgba(255, 215, 0, 1)"
/// bg_color2 : "rgba(255, 69, 0, 1)"
/// image_fill_style8 : "1"
/// hd_image2 : {"attachment_url":""}

class LotterHomeData extends ContentData{
  LotterHomeData({
      this.pageMarginBottom,
      this.pageMarginTop,
      this.automatic,
      this.prizeColor,
      this.btnColor,
      this.animationColor,
      this.bgImage,
      this.uuid,
      this.btnTextColor,
      this.imageFillStyle2,
      this.bdr,
      this.bgColor,
      this.bgColor2,
      this.imageFillStyle8,
      this.hdImage2,}){type = 'raffle';}

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return LotterHomeData.fromJson(json);
  }
  LotterHomeData.fromJson(dynamic json) {
    pageMarginBottom = json['page_margin_bottom'];
    pageMarginTop = json['page_margin_top'];
    automatic = json['automatic'];
    prizeColor = json['prize_color'];
    btnColor = json['btn_color'];
    type = json['type'];
    animationColor = json['animation_color'];
    bgImage = json['bg_image'] != null ? BgImage.fromJson(json['bg_image']) : null;
    uuid = json['uuid'];
    btnTextColor = json['btn_text_color'];
    imageFillStyle2 = json['image_fill_style2'];
    bdr = json['bdr'];
    bgColor = json['bg_color'];
    bgColor2 = json['bg_color2'];
    imageFillStyle8 = json['image_fill_style8'];
    hdImage2 = json['hd_image2'] != null ? HdImage2.fromJson(json['hd_image2']) : null;
  }
  int? pageMarginBottom;
  int? pageMarginTop;
  String? automatic;
  String? prizeColor;
  String? btnColor;
  // String? type;
  String? animationColor;
  BgImage? bgImage;
  String? uuid;
  String? btnTextColor;
  String? imageFillStyle2;
  int? bdr;
  String? bgColor;
  String? bgColor2;
  String? imageFillStyle8;
  HdImage2? hdImage2;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['page_margin_bottom'] = pageMarginBottom;
    map['page_margin_top'] = pageMarginTop;
    map['automatic'] = automatic;
    map['prize_color'] = prizeColor;
    map['btn_color'] = btnColor;
    map['type'] = 'raffle';
    map['animation_color'] = animationColor;
    if (bgImage != null) {
      map['bg_image'] = bgImage?.toJson();
    }
    map['uuid'] = uuid;
    map['btn_text_color'] = btnTextColor;
    map['image_fill_style2'] = imageFillStyle2;
    map['bdr'] = bdr;
    map['bg_color'] = bgColor;
    map['bg_color2'] = bgColor2;
    map['image_fill_style8'] = imageFillStyle8;
    if (hdImage2 != null) {
      map['hd_image2'] = hdImage2?.toJson();
    }
    return map;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }

}

/// attachment_url : ""

class HdImage2 {
  HdImage2({
      this.attachmentUrl,});

  HdImage2.fromJson(dynamic json) {
    attachmentUrl = json['attachment_url'];
  }
  String? attachmentUrl;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['attachment_url'] = attachmentUrl;
    return map;
  }

}

/// attachment_url : ""

class BgImage {
  BgImage({
      this.attachmentUrl,});

  BgImage.fromJson(dynamic json) {
    attachmentUrl = json['attachment_url'];
  }
  String? attachmentUrl;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['attachment_url'] = attachmentUrl;
    return map;
  }

}